import moment from "moment";

const Monday = "周一";
const Tuesday = "周二";
const Wednesday = "周三";
const Thursday = "周四";
const Friday = "周五";
const Saturday = "周六";
const Sunday = "周日";

export function getWeekDay(date) {
  const dayOfWeek = parseInt(moment(date).format("d"));
  switch (dayOfWeek) {
    case 0:
      return Sunday;
    case 1:
      return Monday;
    case 2:
      return Tuesday;
    case 3:
      return Wednesday;
    case 4:
      return Thursday;
    case 5:
      return Friday;
    case 6:
      return Saturday;
  }
}

/**
 * 获取当前年前两年与后两年之间的集合
 */
export function getYears() {
  const year = new Date().getFullYear();
  return [year - 2, year - 1, year, year + 1, year + 2];
}
